import request from '@/utils/request'

// 货主
export function fetchOwnerList(query) {
  return request({
    url: '/owner/list/users',
    method: 'get',
    params: query
  })
}

export function getOwnerTotal(data) {
  return request({
    url: '/owner/all/users',
    method: 'get',
    data
  })
}

export function searchOwnerList(data) {
  console.log(data)
  return request({
    url: '/owner/get',
    method: 'get',
    params: data
  })
}

export function successOwner(id, number) {
  console.log(id)
  return request({
    url: '/owner/approved/' + number + '/' + id,
    method: 'put'
  })
}
export function rejectOwner(id, number) {
  console.log(id)
  return request({
    url: '/owner/reject/' + number + '/' + id,
    method: 'put'
  })
}

// 司机
export function fetchDriverList(query) {
  return request({
    url: '/chauffeur/auth/list',
    method: 'get',
    params: query
  })
}

export function getDriverTotal(data) {
  return request({
    url: '/chauffeur/query/total',
    method: 'get',
    data
  })
}

export function searchDriverList(data) {
  console.log(data)
  return request({
    url: '/chauffeur/query',
    method: 'get',
    params: data
  })
}

export function successDriver(id, data) {
  console.log(id)
  console.log(data)
  return request({
    url: '/chauffeur/approved/' + id,
    method: 'put',
    data: data
  })
}
export function rejectDriver(id, data) {
  console.log(id)
  return request({
    url: '/chauffeur/reject/' + id,
    method: 'put',
    data: data
  })
}

// 车辆
export function fetchCarList(query) {
  return request({
    url: '/vehicle/auth/list',
    method: 'get',
    params: query
  })
}

export function getCarTotal(data) {
  return request({
    url: '/vehicle/query/auth/total',
    method: 'get',
    data
  })
}

export function searchCarList(data) {
  console.log(data)
  return request({
    url: '/vehicle/auth/query',
    method: 'get',
    params: data
  })
}

export function successCar(id, params) {
  console.log(id)
  return request({
    url: '/vehicle/pass/auth/' + id + '/' + params,
    method: 'put'
  })
}
export function rejectCar(id, params) {
  console.log(id)
  return request({
    url: '/vehicle/reject/auth/' + id + '/' + params,
    method: 'put'
  })
}

// 财务
export function fetchFinanceList(query) {
  return request({
    url: '/financial/list',
    method: 'get',
    params: query
  })
}

export function getFinanceTotal(data) {
  return request({
    url: '/financial/total',
    method: 'get',
    data
  })
}

export function searchFinanceList(data) {
  console.log(data)
  return request({
    url: '/financial/search',
    method: 'get',
    params: data
  })
}

export function payToBank(id, state) {
  console.log(id)
  return request({
    url: '/financial/payToBank/' + state + '/' + id,
    method: 'post'
  })
}

// 司机审核列表2020/4/28
export function dirverList(data) {
  return request({
    url: '/chauffeur/check/list',
    method: 'get',
    params: data
  })
}
export function driverStateSet(data) {
  return request({
    url: '/chauffeur/set',
    method: 'PUT',
    params: data
  })
}
export function chauffeurSearch(data) {
  return request({
    url: '/chauffeur/search/list',
    method: 'GET',
    params: data
  })
}
export function chauffeurTotal(data) {
  return request({
    url: '/chauffeur/count',
    method: 'GET',
    params: data
  })
}
